package com.aurora.oa.work.view;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.aurora.oa.R;
import com.aurora.oa.activity.BaseActivity;
import com.aurora.oa.adapter.MainFragmentPageAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/4/24 0024.
 */
public class ApproveMainActivity extends BaseActivity{
    private TabLayout tabs;
    private ViewPager viewPager;
    private List<String> mTitle = new ArrayList<String>();
    private List<Fragment> mFragment = new ArrayList<Fragment>();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initTitlebar(true,"审批",true);
        setMyContentView(R.layout.activity_approve_main);
        initView();
        MainFragmentPageAdapter adapter = new MainFragmentPageAdapter(getSupportFragmentManager(),mFragment ,mTitle );
        viewPager.setAdapter(adapter);
        //为TabLayout设置ViewPager
        tabs.setupWithViewPager(viewPager);
        //使用ViewPager的适配器
        tabs.setTabsFromPagerAdapter(adapter);
    }



    //初始化V
    private void initView() {
        tabs = (TabLayout) findViewById(R.id.tabs);
        viewPager = (ViewPager) findViewById(R.id.viewPager);
        mTitle.add("未审核");
        mTitle.add("已通过");
        mTitle.add("已拒绝");
        mFragment.add(ApproveListFragment.instatant(1));
        mFragment.add(ApproveListFragment.instatant(2));
        mFragment.add(ApproveListFragment.instatant(3));
    }
}
